package cn.com.blueInfo.bpm.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 通用-状态字段
 */
@Getter
@AllArgsConstructor
public enum BaseStatus implements BaseEnum<Integer> {

    /** 已启用 */
    ENABLED(1, "已启用"),
    /** 已停用 */
    DISABLED(2, "未启用"),
    /** 待定 */
    PENDING(3, "待定");

    @EnumValue
    private final Integer code;

    @JsonValue
    private final String desc;

    public static BaseStatus getByCode(Integer code) {
        return BaseEnum.getByCode(BaseStatus.class, code);
    }

    @JsonCreator
    public static BaseStatus fromValue(String value) {
        return BaseEnum.getByName(value, BaseStatus.class);
    }

}
